home *** CD-ROM | disk | FTP | other *** search
- /*
- *
- * OpenAll.c: open all project files
- * © 1994 Jersey Scientific, All Rights Reserved
- *
- * Notes:
- * Ignore failures as we may be trying to open files already open.
- * Not sure what think returns when you try to open an alreayd open file.
- * History:
- * 06/10/94: New External (took about 30 minutes to write and debug)
- */
-
- #include <SetUpA4.h>
- #include "XTRN.h"
-
- Boolean
- main(
- short type, // type of call (XTRN_xxxx, see above)
- XtrnPtr xP, // xtern structure
- XtItemPtr iP, // some fields are for your private use - see above
- short keys // modifier keys associated with this event (KEY, MENU, and ZOOM only)
- // - or the event return code
- ) {
- FSSpec *fsspP, *ofsspP;
- short count, i;
- Str255 str;
- Boolean retCode, ret;
-
- RememberA0();
- SetUpA4();
-
- retCode = FALSE; // default return value
-
- // decide what to do based on the action
- switch(type) {
- case XTRN_INIT:
- case XTRN_QUIT:
- case XTRN_RAW:
- case XTRN_COOKED:
- case XTRN_WIND_OPEN1_SIZE:
- case XTRN_WIND_OPEN2_DATA:
- case XTRN_WIND_CLOSE:
- case XTRN_ZOOM:
- goto ret;
-
- case XTRN_KEY:
- case XTRN_MENU:
- break; // handle below
- }
-
- // now, look at the key modifiers
- switch(keys) {
- case 0:
- // this will ONLY work for THINK 6 or newer, not THINK 5
- ret = (*xP->getFiles)(xP->window, FILES_PROJ_SRC, &ofsspP, &count);
- if(ret == TRUE) {
- fsspP = ofsspP;
- for(i=0; i<count; ++i) {
- if(CAPSLOCK) {
- (*xP->debugPrintf)("Open file %#s", (fsspP++)->name);
- } else {
- ret = (*xP->AEOpen)(fsspP++);
- if(ret != TRUE) {
- ; // alert? Sysbeep?
- }
- }
- }
- DisposePtr((Ptr)ofsspP);
- } else {
- (*xP->softBeep)();
- }
- retCode = TRUE; // doesn't do anything
- break;
- default:
- SysBeep(1);
- break;
- }
-
- ret:
- RestoreA4();
- return retCode;
- }